<?php

namespace Biz\model\brandPack;

use Doraemon\pockets\datebase\BaseDbModel;

class BrandPackageRightsLog extends BaseDbModel
{
    public const _CONFIG_FILE_ = 'db_store';

    public const _CONFIG_SELECT_ = 'db_store';

    public const _DATABASE_ = 'store';

    public const _TABLE_NAME = 'brand_package_rights_log';

    public const TYPE_ADD = 1; //新增

    public const TYPE_CLOSE = 2; //关闭

    public const TYPE_CHANGE_RIGHTS_NUM = 3; //修改权益数量


    public static function insertData($data)
    {
        if (!isset($data['addtime'])) {
            $data['addtime'] = time();
        }
        if (!isset($data['edittime'])) {
            $data['edittime'] = time();
        }
        $ret = static::insert($data);
        if ($ret->errorCode() !== '00000') {
            return false;
        }
        return self::id();
    }

    public static function selectList($where, $select = '*')
    {
        return static::select($select, $where);
    }

    public static function selectCount($where)
    {
        return static::count($where);
    }

}